<template>

  <!-- 显示加载 -->
  <van-config-provider :theme-vars="themeVars">
    <van-overlay :show="props.loading" class="overlay">
      <van-loading size="30px" color="#e54847" v-if="props.loading" class="loading" />
    </van-overlay>
  </van-config-provider>


  <!-- 使用方法：
  <LoadingCmp :loading="loading" v-if="loading" />
  -->


</template>





<style scoped>
:deep(.overlay) {
  background-color: #fff;
}

.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
</style>



<script setup>
import { ref } from 'vue'

// const loading = ref(true);


const props = defineProps({
  loading: {
    type: Boolean,
    default: true,
  }
})


</script>
